home *** CD-ROM | disk | FTP | other *** search
- /* 1st Darklord module */
-
- #include "vdi.h"
- #include "stdlib.h"
- #include "mod_head.h"
-
- #define OFFSET 12
- #define START 0
- #define STOP 3600
-
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #endif
-
- int calc_num(int, int);
-
- int main(DKL_INFO *dark_pars)
- {
- short handle, xres, yres;
- short pxy[4];
- int *exit_flag;
- int max_colours;
- short centrex, centrey, perm_radius1, perm_radius2;
- short temp_radius1, temp_radius2, colour;
- int min_rad, max_rad, spheres;
-
- xres=dark_pars->dk_xres;
- yres=dark_pars->dk_yres;
- handle=dark_pars->dk_handle;
- exit_flag=dark_pars->dklord_flag;
- max_colours=dark_pars->dk_pens;
- min_rad=dark_pars->dk_start1;
- max_rad=dark_pars->dk_start2;
- spheres=dark_pars->dk_flag1;
-
- pxy[0]=0;
- pxy[1]=0;
- pxy[2]=xres;
- pxy[3]=yres;
- vs_clip(handle, TRUE, pxy); /* set clip rectangle */
-
- while(*exit_flag) {
- perm_radius1=(short)calc_num(min_rad, max_rad);
- perm_radius1=(perm_radius1/5)*5;
- if(spheres==1) perm_radius2=perm_radius1;
- else if(spheres==2) {
- perm_radius2=(short)calc_num(min_rad,max_rad);
- perm_radius1=(perm_radius1/5)*5;
- }
-
- centrex=(short)calc_num(OFFSET, xres-OFFSET);
- centrey=(short)calc_num(OFFSET, yres-OFFSET);
- colour=(short)calc_num(1, max_colours); /* choose a colour */
- vsl_color(handle, colour);
- vsf_interior(handle, FIS_HOLLOW); /* hollow fill */
- vsf_color(handle, colour); /* chosen colour */
- vsf_perimeter(handle, TRUE); /* perimeter on */
-
- v_ellipse(handle, centrex, centrey, perm_radius1, perm_radius2);
- temp_radius1=perm_radius2-5;
- temp_radius2=perm_radius1-5;
- v_ellarc(handle, centrex, centrey, perm_radius1, perm_radius2, START, STOP);
-
- while(TRUE){
- if(temp_radius1>=0) v_ellarc(handle, centrex, centrey, perm_radius1, temp_radius1, START, STOP);
- if(temp_radius2>=0) v_ellarc(handle, centrex, centrey, temp_radius2, perm_radius2, START, STOP);
- temp_radius1-=5;
- temp_radius2-=5;
- if(temp_radius1<0 && temp_radius2<0) break;
- }
- }
- return 0;
- }
- /* -------------------------------------------------------------------- */
- int calc_num(int min, int max)
- {
- int diff;
-
- diff=max-min;
- if(!diff) diff=1; /* avoid divide-by-zero exception */
- return ((rand()%diff)+min);
- }
- /* -------------------------------------------------------------------- */
-